<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <body>

        <ui:composition template="./template.xhtml">

            <ui:define name="title">
                Phê duyệt nội dung dịch vụ
            </ui:define>

            <ui:define name="content">
                <h:form>
                    Xem từ ngày 
                    <p:calendar value="#{subCpConfigApproveBean.startViewDate}" pattern="dd/MM/yyyy" timeZone="Asia/Saigon" navigator="true"/>
                    đến ngày 
                    <p:calendar value="#{subCpConfigApproveBean.endViewDate}" pattern="dd/MM/yyyy" timeZone="Asia/Saigon" navigator="true"/>
                    <p:commandButton value="Hiển thị" update="table" action="#{subCpConfigApproveBean.resetToCreateForm()}"/>
                    <br/>
                    <br/>

                    <p:dataTable id="table" value="#{subCpConfigApproveBean.list}" var="item" paginator="#{subCpConfigApproveBean.list.size() >20}" rows="20" 
                                 selection="#{subCpConfigApproveBean.selectedList}" selectionMode="multiple" resizableColumns="true">

                        <f:facet name="header">  
                            <div align="left">
                                <p:commandButton ajax="false" value="Phê duyệt" image="ui-icon ui-icon-pencil" action="#{subCpConfigApproveBean.aprroveSelected()}"/>
                            </div>
                        </f:facet> 

                        <f:facet name="footer">  
                            <div align="left">
                                <p:commandButton ajax="false" value="Phê duyệt" image="ui-icon ui-icon-pencil" action="#{subCpConfigApproveBean.aprroveSelected()}"/>
                            </div>
                        </f:facet> 

                        <p:column headerText="Đầu số" sortBy="#{item.cpNumber}">
                            #{item.cpNumber}
                        </p:column>
                        <p:column headerText="Bắt đầu" sortBy="#{item.startEffect}">
                            <h:outputText value="#{item.startEffect}">
                                <f:convertDateTime pattern="dd/MM/yyyy HH:mm:ss" timeZone="Asia/Saigon"/>
                            </h:outputText>
                        </p:column>
                        <p:column headerText="Kết thúc" sortBy="#{item.endEffect}">
                            <h:outputText value="#{item.endEffect}">
                                <f:convertDateTime pattern="dd/MM/yyyy HH:mm:ss" timeZone="Asia/Saigon"/>
                            </h:outputText>
                        </p:column>
                        <p:column headerText="MO" sortBy="#{item.deliverContent}">
                            #{item.deliverContent}
                        </p:column>
                        <p:column headerText="Nội dung trả về" sortBy="#{item.content}">
                            #{item.content}
                        </p:column>
                        <p:column headerText="Tạo bởi" sortBy="#{item.createdBy}">
                            #{item.createdBy}
                        </p:column>
                        <p:column headerText="Phê duyệt" sortBy="#{item.approveStatus}">
                            #{item.approveStatus}
                        </p:column>
                        <p:column headerText="Phê duyệt bởi" sortBy="#{item.approvedBy}">
                            #{item.approvedBy}
                        </p:column>
                    </p:dataTable>
                </h:form>
            </ui:define>

        </ui:composition>

    </body>
</html>
